package fr.upmc.alasca.centreCalcul.interne.machinePhysique.ports;

import java.util.List;

import fr.upmc.alasca.centreCalcul.interne.machinePhysique.MachinePhysique;
import fr.upmc.alasca.centreCalcul.interne.machinePhysique.interfaces.MachinePhysiqueApplicationI;
import fr.upmc.components.ComponentI;
import fr.upmc.components.ports.AbstractInboundPort;

/**
 * @author Antoine Lavaire, Sabri Labassi, Thibaut Fleury, Ryme Fantazi
 */
public	class	MachinePhysiqueApplicationInboundPort
extends			AbstractInboundPort
implements		MachinePhysiqueApplicationI
{
	private static final long serialVersionUID = 1L;

	

	public		MachinePhysiqueApplicationInboundPort
	(
			String uri,
			ComponentI owner
	) throws	Exception
	{
		super(uri, MachinePhysiqueApplicationI.class, owner);
		
		assert uri != null && owner instanceof MachinePhysique;
	}

	
	/**
	 * @see fr.upmc.alasca.centreCalcul.interne.machinePhysique.interfaces.MachinePhysiqueAdmissionI#reserverCoeur(java.lang.String, int)
	 */
	@Override
	public	int		reserverCoeur
	(
			String 	uriApplication,
			int 	nbCoeursAReserver
	) throws	Exception
	{
		final MachinePhysique mp = (MachinePhysique)this.owner;
		
		return mp.reserverCoeur(uriApplication, nbCoeursAReserver);
	}
	
	
	/**
	 * @see fr.upmc.alasca.centreCalcul.interne.machinePhysique.interfaces.MachinePhysiqueAdmissionI#relacherCoeur(java.lang.String, int)
	 */
	@Override
	public	void	relacherCoeur
	(
			String	uriApplication,
			List<String> uriCoeurs
	) throws	Exception
	{
		final MachinePhysique mp = (MachinePhysique)this.owner;
		
		mp.relacherCoeur(uriApplication, uriCoeurs);
	}

	
	/**
	 * @see fr.upmc.alasca.centreCalcul.interne.machinePhysique.interfaces.MachinePhysiqueApplicationI#recupererMV(java.lang.String)
	 */
	@Override
	public	String 	recupererMV
	(
			String	uriApplication
	) throws	Exception
	{
		final MachinePhysique mp = (MachinePhysique)this.owner;
		
		return mp.recupererMV(uriApplication);
	}

	
	/**
	 * @see fr.upmc.alasca.centreCalcul.interne.machinePhysique.interfaces.MachinePhysiqueApplicationI#modifierFrequenceCoeurs(java.lang.String, float)
	 */
	@Override
	public	float	appliquerNouvelleFrequence
	(
			String	uriApplication
	) throws	Exception
	{
		final MachinePhysique mp = (MachinePhysique)this.owner;
		
		return mp.appliquerNouvelleFrequence(uriApplication);
	}


	@Override
	public 	void	allouerCoeurs(String uriApplication) throws Exception {
		final MachinePhysique mp = (MachinePhysique)this.owner;
		
		 mp.allouerCoeurs(uriApplication);
	}


	@Override
	public	boolean	reserverNouvelleFrequence(String uriApplication,
			String uriCoeur, float nouvelleFrequence) throws Exception {
		
		final MachinePhysique mp = (MachinePhysique)this.owner;
		return mp.reserverNouvelleFrequence(uriApplication, uriCoeur, nouvelleFrequence);
	}


	@Override
	public void shutdownApplication(String uriApplication) throws Exception {
		((MachinePhysique)this.owner).shutdownApplication(uriApplication);
	}

	
	

}
